home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_09
/
2n09053a
< prev
next >
Wrap
Text File
|
1991-08-02
|
19KB
|
443 lines
PAGE ,132
TITLE SCROLOCK -- Holds screen every page
COMMENT $
SCROLOCK.EXE -- Locks scrolling of screen
Generate EXE file using the following commands:
MASM SCROLOCK;
LINK SCROLOCK;
Load from CONFIG.SYS file by use of the command:
DEVICE=SCROLOCK.EXE followed by an optional line count
and an optional keyword ON. If no line count is given,
the CGA normal line count of 25 will be used. If the
keyword ON is used, Scroll-Lock will be turned on.
Load at system command or from within AUTOEXEC.BAT.
Type: SCROLOCK followed by an optional line count and
an optional keyword ON as above.
To use, toggle the Scroll-Lock key to activate and
deactivate. If active, the screen will fill to the
bottom, then it will scroll until the line where the
cursor was when the last key was struck is now at the
top of the screen, then it will freeze with the
cursor in the bottom left corner. To get the next
screen-full, hit any key. Note: The key will be used
later, so if you want just another screen-full, hit
the Alt or either Shift key.
$
; ************************************************************
; * *
; * Dummy Device Driver Header *
; * *
; ************************************************************
CSEG SEGMENT
ORG 0000H ; For all device drivers
Header DD -1 ; One device
DW 08000H ; Character device
StratA DW Strat ; Strategy entrance
IntrA DW Intr ; Interrupt entrance
DB 'Scrolock' ; 8 character dummy name
; ************************************************************
; * *
; * Resident data *
; * *
; ************************************************************
; ROM BIOS DATA AREAS
; -------------------
BIOS_DATA SEGMENT AT 00040H
ORG 00017H
KB_FLAG DB ?
SCROLL_STATE EQU 010H
ORG 00050H
CURSOR_POSN DW 8 DUP(?) ; 8 pages of cursor positions
CURSOR_MODE DW ? ; Current cursor mode setting
ACTIVE_PAGE DB ? ; Current page being displayed
BIOS_DATA ENDS
; RESIDENT DATA
; -------------
OldIntr09 DW ? ; Interrupt vector storage
DW ?
OldIntr10 DW ?
DW ?
LineCount DB ? ; Line counter
OddEven DB 0 ; CR sets even = 0
MaxRows DB 25 ; Maximum screen rows
; ************************************************************
; * *
; * Resident code *
; * *
; ************************************************************
; Intercept of Interrupt 10H -- BIOS Video Call
; ---------------------------------------------
ASSUME CS:CSEG, DS:NOTHING, ES:NOTHING
NewIntr10:
STI ; Allow interrupts
PUSH DS ; Save registers
PUSH ES
PUSH AX
PUSH BX
PUSH CX
PUSH AX
MOV AX,SEG BIOS_DATA ; Set ES = BIOS_DATA segment
MOV ES,AX
POP AX
PUSH CS ; Set DS = CS
POP DS
ASSUME DS:CSEG, ES:BIOS_DATA
TEST KB_FLAG,SCROLL_STATE ; Scroll-Lock on?
JZ ExitIntr10 ; No, not locked
CMP AH,000H ; Change video mode?
JE ClrScr ; Yes, stop at bottom
CMP AX,00600H ; Clear video screen?
JE ClrScr ; Yes, stop at bottom
CMP AX,00601H ; Roll up one line?
JE RollUp ; Yes, do that type
CMP OddEven,002H ; Is roll active?
JE ExitIntr10 ; Yes, don't do cursor
CMP AH,002H ; Cursor command?
JE CurMov ; Yes, test what move
ExitIntr10:
POP CX ; Restore registers
POP BX
POP AX
POP ES
POP DS
ASSUME DS:NOTHING, ES:NOTHING
JMP DWORD PTR OldIntr10 ; Perform video request
ASSUME DS:CSEG, ES:BIOS_DATA
ClrScr:
MOV AL,MaxRows
MOV LineCount,AL ; Do not allow any roll
MOV OddEven,000H ; Reset CR LF counter
JMP ExitIntr10 ; Exit Intr svc.
RollUp:
CMP CX,000H ; From first line?
JNE ExitIntr10 ; No, exit
MOV AL,MaxRows
CMP DH,AL ; To last line?
JNE ExitIntr10 ; No, exit
INC LineCount ; Yes, now count lines
MOV OddEven,002H ; Turn off cursor type
RollLoop:
CMP LineCount,AL ; Maximum roll?
JA RollLoop ; Yes, loop until key pressed
JMP ExitIntr10 ; No, roll some more
CurMov:
CMP BH,ACTIVE_PAGE ; Cursor for active page?
JNE ExitIntr10 ; No, set for other page
MOV BL,BH ; Get cursor pointer
SUB BH,BH
SHL BX,1
MOV CX,[BX+CURSOR_POSN] ; Get cursor position
CMP CH,MaxRows ; At bottom row?
JNE ExitIntr10 ; No, don't do anything
OR DL,DL ; To column 0?
JNE ExitIntr10 ; No, exit
CMP DH,MaxRows ; To last line?
JNE ExitIntr10 ; No, exit
OR CL,CL ; From column 0?
JE NotEven ; Yes, probably a LF
MOV OddEven,000H ; A CR for sure - even up
NotEven:
NOT OddEven ; Alternate CR LF
CMP OddEven,000H ; Probable LF?
JE ExitIntr10 ; Yes, skip LFs
INC LineCount ; No, now count lines
CMP LineCount,AL ; Maximum roll?
JNA ExitIntr10 ; No, roll some more
MOV AH,002H ; Put cursor in corner
MOV BH,ACTIVE_PAGE
PUSHF
CALL DWORD PTR OldIntr10
MOV AL,MaxRows ; Needed for release
JMP RollLoop ; Loop as above
; Intrercept of Intrerrupt 9H -- Hardware Keyboard
; ----------------------------------------------
NewIntr09:
ASSUME DS:NOTHING, ES:NOTHING
PUSH AX ; Save registers
IN AL,060H ; Read scan code
TEST AL,080H ; Key pressed?
JNE ExitIntr09 ; No, exit
PUSH BX ; Save registers
PUSH CX
PUSH DX
PUSH ES
MOV AX,SEG BIOS_DATA ; Set ES = BIOS_DATA segment
MOV ES,AX
ASSUME ES:BIOS_DATA
MOV BL,ACTIVE_PAGE ; Get cursor pointer